﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Wicresoft.EKA.Atrium.WebService.CMDBInstanceManager;

namespace Wicresoft.EKA.Atrium.WebService
{
    public class CMDBInstanceMgr
    {
        //public Security Sercuirty { get; set; }
        //[SoapHeader("Sercuirty")]
        public GetInstancesOutput ListInstances()
        {
            System.Net.ServicePointManager.ServerCertificateValidationCallback = TrustAllCertificatePolicy.CheckValidationResult;
            atrium_instances proxy = new atrium_instances();
            proxy.Sercuirty = Security.GetSecuritySoapHeader("Demo", "Pass01!");

            //proxy.Credentials = new NetworkCredential("admin", "Pass01!", "");

            var x= proxy.GetInstances(new GetInstances()
            {
                classNameId = new ClassNameId()
                {
                    className = "BMC_Application",
                    namespaceName = "BMC.CORE"
                },
                //firstRetrieve = 10,
                datasetId = "BMC.ASSET",
                query = "",
                //attributes = new string[] { "Item", "Type" },
                sortOrder = new SortOrder[] { 
                     new SortOrder()
                     {
                         attributeName="Item",
                         sortOrder=SortOrderType.ASCENDING
}
                     },
                getMask = GetMask.DATASET_MODE_CURRENT
            });

            return x;

        }
    }
}
